var a = [5,1,8,10,4];
var b=[]
b=a.sort(function(a,b){return b-a})
document.write(b)